priority -50

snippet xml "XML declaration" b
<?xml version="1.0"?>

endsnippet

snippet t "Simple tag" b
<${1:tag}>
	${2:${VISUAL}}
</${1/([\w:._-]+).*/$1/}>
endsnippet

snippet ti "Inline tag" b
<${1:tag}>${2:${VISUAL}}</${1/([\w:._-]+).*/$1/}>
endsnippet

snippet ehz "ECAT HZNCC xml" b
﻿<?xml version="1.0"?>
<!--
请添加修改日志
===================
`date +%Y%m%d` 新建EtherCAT XML 固件
===================
-->
<EtherCATInfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="EtherCATInfo.xsd" Version="1.2">
	<Vendor>
		<Id>2129</Id>
		<Name LcId="1033">HNC Automation GmbH</Name>
<ImageData16x14>424DE6000000000000007600000028000000100000000E000000010004000000000070000000120B0000120B0000100000001000000000000000000080000080000000808000800000008000800080800000C0C0C000808080000000FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF009D9DD99DD9DDD9DD9D9D9DD9D9DDD9DD999D9DD9D999D9999D9D9DD9D9DDD9DD9D9DD99DD999D999DDDDDDDDDDDDDDDD88888888888888888888888888888888DDDDDDDDDDDDDDDD999D999DD99DD9D99D9D9DDD9DD9D9D999DD999D9DDDD99D9D9D9DDD9DD9D99D999D999DD99DD9D9</ImageData16x14>
	</Vendor>
	<Descriptions>
		<Groups>
			<Group>
				<Type>HIO-11XX</Type>
				<Name LcId="1033">EtherCAT Piggyback controller boards (HIO-11XX)</Name>
				<Name LcId="1031">EtherCAT Briefmarken (HIO-11XX)</Name>
				<ImageData16x14>424DD6020000000000003600000028000000100000000E0000000100180000000000A0020000120B0000120B00000000000000000000FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF0000FFFF00FFFF00FFFF00FF0000FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF0000FFFF00FFFF00FF0000FF0000FF0000FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF0000FF0000FF0000FFFF00FFFF00FF0000FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF0000FFFF00FFFF00FFFF00FF0000FFFF00FF008000008000008000008000008000008000008000008000404040404040404040404040404040404040404040404040008000007FFF007FFF00800000800000800000800000800040404000800000800000800000800000800000800040404000800000800000800000800000800000800000800000800040404000800000800000800000800000800000800040404000800000800000800000800000800000800000800000800040404000800000800000800000800000800000800040404000800000800000800000800000800000800000800000800040404040404040404040404040404040404040404040404000800000800000800000800000800000800000800000800000800000800000800000800000800000800000800000800000800000FFFF00800000FFFF00800000800000FFFF00800000FFFF00800000800000800000FFFF00800000FFFF00800000800000800000800000800000800000800000800000800000800000800000800000800000800000800000800000800000800000FFFF00800000FFFF00800000800000FFFF00800000FFFF00800000800000800000FFFF00800000FFFF008000008000008000008000008000008000008000008000008000008000008000008000008000008000008000008000008000</ImageData16x14>
			</Group>
		</Groups>
        <Devices>
        <!--添加设备-->

		</Devices>
	</Descriptions>
</EtherCATInfo>
endsnippet
snippet edev "ecat device module" iw
<Device Physics="YY">
    <Type ProductCode="#x0851${1:0000}" RevisionNo="`date +%Y%m%d`">HNC HC$1</Type>
    <HideType RevisionNo="#x0064008E"/>
    <Name LcId="1031">HC$1</Name>
    <GroupType>HIO-11XX</GroupType>
    <Eeprom>
        <ByteSize>2048</ByteSize>
        <ConfigData>8d00380e0a0000002233</ConfigData>
        <!-- eeprom 0字：PDI控制，注意此处et1100和lan9252此处不同，lan9252：0x80表示spi,0x8d表示变址16位访问 -->
        <!--
        -第一个字节配置 0x140 寄存器， 8d:HBI index 16bit
	    -第二个字节配置 0x141 寄存器
	    -第三个字节配置 0x150 寄存器 0x38,cs,read,write,高电平有效
	    -第四个字节配置 0x151 寄存器 0x0e,sync0开启，push-pull，高电平有效
	    -第五，六字节配置 0x982-983 寄存器,0x000a,sync 有效宽度 10×10ns
	    -第七，八字节配置 0x152-153 寄存器
	    -第九，十字节配置 0x12-13 寄存器 0x2233:从站别名
	    -第11，12字节配置 0x510-511 寄存器，0x142-0x143寄存器
	    -第13，14字节配置 0x144-145 寄存器
        -
        -->
    </Eeprom>
    <Info>
        <Electrical>
            <EBusCurrent>-2000</EBusCurrent>
        </Electrical>
    </Info>
    <!--属性定义-->
    <Profile>
        <Dictionary>
            <DataTypes>
                <DataType>
                    <Name>BOOL</Name>
                    <BitSize>1</BitSize>
                </DataType>
			    <DataType>
			    <Name>BIT3</Name>
				    <BitSize>3</BitSize>
			    </DataType>
			    <DataType>
				    <Name>BIT5</Name>
			    <BitSize>5</BitSize>
			    </DataType>
		        <DataType>
				    <Name>BYTE</Name>
				    <BitSize>8</BitSize>
			    </DataType>
                <DataType>
				    <Name>SINT</Name>       <!--short int-->
				    <BitSize>8</BitSize>
			    </DataType>
			    <DataType>
			        <Name>USINT</Name>       <!--unsigned short int-->
				    <BitSize>8</BitSize>
			    </DataType>
			    <DataType>
				    <Name>INT</Name>       <!--int-->
			        <BitSize>16</BitSize>
			    </DataType>
			    <DataType>
				    <Name>UINT</Name>       <!--unsigned int-->
			        <BitSize>16</BitSize>
			    </DataType>
			    <DataType>
				    <Name>DINT</Name>       <!--double int-->
			        <BitSize>32</BitSize>
			    </DataType>
			    <DataType>
				    <Name>UDINT</Name>       <!--unsigned double int-->
			        <BitSize>32</BitSize>
			    </DataType>
			    <DataType>
			        <Name>ULINT</Name>
				    <BitSize>64</BitSize>
			    </DataType>
		        </DataTypes>
		    </Dictionary>
	    </Profile>
        <Fmmu>Inputs</Fmmu>
        <Fmmu>Outputs</Fmmu>
        <Sm MinSize="128" MaxSize="128" DefaultSize="128" StartAddress="#x1000" ControlByte="#x26" Enable="1">MBoxOut</Sm>
        <Sm MinSize="128" MaxSize="128" DefaultSize="128" StartAddress="#x1080" ControlByte="#x22" Enable="1">MBoxIn</Sm>
        <Sm MinSize="4" MaxSize="64" DefaultSize="4" StartAddress="#x1100" ControlByte="#x24" Enable="1">Outputs</Sm>
        <Sm MinSize="4" MaxSize="64" DefaultSize="4" StartAddress="#x1140" ControlByte="#x20" Enable="1">Inputs</Sm>
        <RxPdo Mandatory="true" Fixed="true" Sm="2"> 
            <Index>#x1601</Index>
            <Name>Output</Name>
            <!--添加rxpdo-->
            ${3}
        </RxPdo>
        <TxPdo Mandatory="true" Fixed="true" Sm="3">
            <Index>#x1a00</Index>
            <Name>Input</Name>
            <!--添加txpdo-->
            ${0}
        </TxPdo>
		<Dc Unknown64Bit="1">
	    <!--预先定义一个或者多个 opmode 第一个opmode是默认-->
		    <OpMode>
			    <Name>DcSync</Name>
			    <Desc>Dc for Sync</Desc>
			    <AssignActivate>#x0300</AssignActivate> <!--16进制，寄存器0x0980,0x0981-->
			    <CycleTimeSync0 Factor="1">0</CycleTimeSync0>
			    <ShiftTimeSync0>0</ShiftTimeSync0>
			    <CycleTimeSync1 Factor="-1">0</CycleTimeSync1>
			    <ShiftTimeSync1>0</ShiftTimeSync1>
		    </OpMode>
	    </Dc>
</Device>
endsnippet

snippet ten "txpdo entry" iw
<Entry>
    <Index>#x6000</Index>
    <SubIndex>${1}</SubIndex>
    <BitLen>${2}</BitLen>
    <Name>${3}</Name>
    <DataType>${0}</DataType>
</Entry>
endsnippet
snippet ren "rxpdo entry" iw
<Entry>
    <Index>#x7000</Index>
    <SubIndex>${1}</SubIndex>
    <BitLen>${2}</BitLen>
    <Name>${3}</Name>
    <DataType>${0}</DataType>
</Entry>
endsnippet
